

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1"><title>
	医生问题病案首页
</title><link href="../css/adminCss.css" rel="stylesheet" type="text/css" />
    <script src="../js/jquery-1.8.3.min.js" type="text/javascript"></script>
     <script src="../js/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
    <link href="../iconfont/iconfont.css" rel="stylesheet" type="text/css" />
    <!--字体图标-->
    <link href="../js/layui/css/layui.css" rel="stylesheet" media="all" />
    <script src="../js/layui/xm-select/xm-select.js"></script>
         
<script>
    document.onkeydown=keyListener;
    function keyListener(e){
        e = e ? e : event;
        if (e.keyCode == 13) {
            $("button[lay-filter=btnSearch]").trigger('click');
            
        }
    }
</script>
</head>
<body>
     <div class="layui-form ">

    <!--顶部位置导航栏-->
    <div class="layui-card layadmin-header">
        <i class="iconfont iconshouye1"></i>&nbsp;<span id="lblPath">病案管理 >> 问题病案 >> 问题病案</span>
        
        <span id="HidModuId" class="nodisp">764</span>
        <span id="DeptIdChildren" class="nodisp">0</span>
        <div class="advanced-search-btn fr">
                <button class="layui-btn  layui-btn-sm" lay-submit lay-filter="btnSearch"><i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>搜索</button>
            </div>
            <div class="advanced-search pr10 fr">高级搜索<i class="iconfont iconarrow-down"></i></div>
            <script>
                $(document).ready(function () {
                    $(".advanced-search").toggle(function () {
                        $(".layui-search-h").css("height", "auto");
                        $(".layui-search-h").addClass("pb5")
                        $(".advanced-search").html("高级搜索<i class='iconfont iconarrow-up'></i>");
                    }, function () {
                        $(".layui-search-h").css("height", "45px");
                        $(".layui-search-h").removeClass("pb5");

                        $(".advanced-search").html("高级搜索<i class='iconfont iconarrow-down'></i>");
                    });
                });
        </script>
    </div>

   <!-- 列表 -->
        <div class="layui-body-mp" style="left: 0;">
            <div class="layui-card">
            <!--顶部搜索栏-->
            <div class=" layui-card-header">
                <div class="layui-form-item layui-search-h" style="float:right">
                    
                    <div class="layui-inline">
                        <label class="layui-form-label">住院号</label>
                        <div class="layui-input-inline  select-wd120">
                             <input type="text" name="HospitalNumber" placeholder="请输入" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">医生姓名</label>
                        <div class="layui-input-inline select-wd120">
                            <input type="text" name="DoctorUserName" placeholder="请输入" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">科室</label>
                        <div class="layui-input-inline  select-wd120">
                             <div id="DeptId" name="DeptId"  class="layui-input xm-select-demo"></div>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">问题类别</label>
                        <div class="layui-input-inline  select-wd120">
                             <input type="text" name="ProblemCategory" placeholder="请输入" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                            <label class="layui-form-label">出院时间</label>
                            <div class="layui-input-inline select-wd120">
                                <input id="strSearchDate" name="strSearchDate"  type="text" class="layui-input  Wdate" check_null="出院时间必填" readonly="readonly" placeholder="出院日期-年/月" onclick="WdatePicker(({ dateFmt: 'yyyy-MM' }))">
                            </div>
                        </div>
                    
                   



                    
                </div>
            </div>


            <!--顶部工具栏按钮-->
            <script type="text/html" id="toolbar">
                <div class="layui-btn-container">
                    
                    <button type="button" class="layui-btn layui-btn-sm" lay-event="btnAdd"><i class="iconfont iconchangyongtubiao-xianxingdaochu-zhuanqu-10"></i>添加</button>
                    <button type="button" class="layui-btn layui-btn-danger layui-btn-sm" lay-event="btnDel"><i class="iconfont iconchangyongtubiao-xianxingdaochu-zhuanqu-5"></i>删除</button>

                    <button type="button" class="layui-btn layui-btn-sm" lay-event="btnExport"><i class="iconfont icondaochu"></i> 导出</button><button type="button" class="layui-btn layui-btn-sm" lay-event="btnImport"><i class="iconfont icon_daoru"></i> 导入</button>
                </div>
            </script>

            <!--数据列表-->
            <table id="GvData" lay-filter="GvData" class="layui-table" ></table>
            <!--数据列表右侧操作栏-->
            <script type="text/html" id="GvDataTabBar">


                 <a class="layui-btn layui-btn-xs" lay-event="columEdit" style="text-decoration:underline;"> 编辑</a>
            </script>

        </div>
 
        </div>

    </div>
    
    <script src="../js/layui/layui.js"></script>
    <script src="../js/layAdmin/global.js"></script>
    
    <script>
        layui.use(['list'], function () {
            var list = layui.list;
            var form = list.form, table = list.table, element = list.element, util = list.util, laypage = list.laypage, layer = list.layer, layedit = list.layedit;
            //-----------------------------设置页面类型---------------------------------
            //左树右列表
            list.setter({ "pageType": "List" });
            //-----------------------------设置主键---------------------------------
            //table主键与tree主键
            let primaryKey = "MedicalRecordId";
            list.setter({ "primaryKay": primaryKey });
            //-----------------------------是否开启部门职务搜索框下拉树---------------------------------
            //使用xm树
            list.setter({ "useXmSelect": true });
            list.setter({ "Xmheight": "400px" });
            list.setter({ "targetids": ["DeptId"], "targetimethods": ["depttree"] });

            

            //--------------------------设置表格字段-----------------------
             table.render({
                elem: '#GvData'
                , cellMinWidth: 80   //单元格最小宽度
                //, even: true
                , url: '?Method=datalist&moduid=764' //数据接口
                , where: {
                    strSearchDate: $("#strSearchDate").val()
                 }
                 , toolbar: '#toolbar' //表格顶部工具栏
                 , page: true //开启分页
                 , limit: 20 //每页默认显示的数量
                ,limits: [10,20,50,100,200,500]
                ,height: 'full-100' //高度自适应 需要减去固定值
                , cols: [[ //表头
                    { checkbox: 'true', fixed: 'left' }
                    , { field: 'HospitalNumber', title: '住院号', align: 'center', fixed: 'left' }
                    , { field: 'DoctorUserId', title: '医师ID', align: 'center' }
                    , { field: 'DoctorUserName', title: '医师', align: 'center' }
                    , { field: 'DeptId', title: '科室ID', align: 'center' }
                    , { field: 'DeptName', title: '科室',width: 130 }
                    ,{ field: 'RecordDate', title: '出院时间', align: 'center', width: 100, templet: '<div>{{ layui.util.toDateString(d.RecordDate, "yyyy-MM-dd") }}</div>' }
                    , { field: 'ProblemCategory', title: '问题类别', align: 'center' }
                    , {
                        field: 'ProblemItem', title: '问题项目', width: 160
                        , templet: function (d) { 
                            if (d.ProblemItem == "") {
                                return '';
                            } else {
                                let strHtml = "<div>";
                                let arr = d.ProblemItem.split("\\n");
                                console.log(arr);
                                for (let i = 0; i < arr.length; i++) {
                                    strHtml += arr[i]+"</br>";
                                }
                                strHtml += "</div>";
                                return strHtml;
                            }
                        }
                    }
                    , {
                        field: 'ProblemRemark', title: '问题描述', width: 300
                        , templet: function (d) { 
                            if (d.ProblemRemark == "") {
                                return '';
                            } else {
                                let strHtml = "<div>";
                                let arr = d.ProblemRemark.split("\\n");
                                console.log(arr);
                                for (let i = 0; i < arr.length; i++) {
                                    strHtml += arr[i]+"</br>";
                                }
                                strHtml += "</div>";
                                return strHtml;
                            }
                        }
                    }
                    , {
                        field: 'RectificationOpinions', title: '整改意见', width: 300
                        , templet: function (d) { 
                            if (d.RectificationOpinions == "") {
                                return '';
                            } else {
                                let strHtml = "<div>";
                                let arr = d.RectificationOpinions.split("\\n");
                                console.log(arr);
                                for (let i = 0; i < arr.length; i++) {
                                    strHtml += arr[i]+"</br>";
                                }
                                strHtml += "</div>";
                                return strHtml;
                            }
                        }
                    }
                    , { field: 'EditUserName', title: '编辑人', align: 'center' }
                    ,{ field: 'EditDate', title: '编辑时间', align: 'center', minWidth: 140, templet: '<div>{{ layui.util.toDateString(d.EditDate, "yyyy-MM-dd HH:mm") }}</div>' }
                    , { field: 'operate', title: '操作', toolbar: '#GvDataTabBar', width: 160, fixed: 'right' }
                ]]
                , done: function (res) {
                    if (list.getter("useXmSelect")) {
                        list.elRenderXmSelect({"type":"list"});//表格加载完后再执行xm-select的渲染
                    }
                    if (list.getter("useelement")) {
                        element.render();//进度条渲染
                    }

                    if (res.count == 0) {
                        //页面首次加载（非搜索），如果程序报错或者没有查找到数据，执行该语句
                        document.documentElement.querySelectorAll(".layui-table-body .layui-none")[0].innerHTML = res.msg;
                    }

                }
            });


            //-----------------------------------------监听右侧操作栏------------------------------------------
            table.on('tool(GvData)', function (obj) { 
                var data = obj.data;//选中的行数据 
                var primaryid = data[primaryKey]; //当前选中行id，根据需要设置
                if (obj.event === 'columEdit') {  //修改

                    url = 'MedicalRecord/MedicalRecordAdd.aspx?fromlayui=1&tableid=GvData&id=' + primaryid;
                    list.funTopOperation({ "type": "Open","zIndex":1000, "title": "修改病案信息", "url": url, "area": ['800px', '500px'], "onlyShow": false, "btn": ['保存', '取消'],"btnId":"btnSave" })(data);
                    
                }
            });


            //---------------------------------------------监听顶部操作按钮------------------------------------------------
            var active = {

                btnAdd: function (data) {
                    url = 'MedicalRecord/MedicalRecordAdd.aspx?fromlayui=1&tableid=GvData';
                    list.funTopOperation({ "type": "Open", "zIndex":1000,"title": "添加病案", "url": url, "area": ['800px', '500px'], "onlyShow": false, "btn": ['保存', '取消'],"btnId":"btnSave" })(data);

                }
                , btnDel: function (data) { //批量删除

                    if (data.length == 0) {
                        layer.alert("请至少选择一项");
                        return false;
                    }

                    var strIds = "";
                    data.forEach(function (value, index) {
                        if (index > 0) {
                            strIds += ",";
                        }
                        strIds += value[primaryKey];
                    });
                    var url = "?Method=BatchDel";
                    var data = "id=" + strIds;
                    //post提交
                    list.funOperation({"type": "confirm","isPost": 1, "postdata": data,  "detail": 1, "url": url, "confirmText": "确定要删除吗？", "resultConfirmText": "操作成功!" })(data);

                }
                , btnImport: function (data) {
                    openDg('win', 'Excel导入', 'MedicalRecord/MedicalRecordExcel.aspx', 600, 450)
                }
                , btnExport: function (data) {
                    DCDownFile("get", '?method=Export');
                }

            }




            //--------------------------------------------顶部工具条事件监听-----------------------------------------------
            //顶部按钮lay-event的值需要以btn开头
            list.funToolbar({ "tableID": "GvData", "seleAll": 1, "active": active });





            //-----------------------------------------加载搜索与开关事件-------------------------------------
            list.funSearch();

        });
    </script>


  


    <script type="text/javascript" src="../js/rows.js"></script>
    <script type="text/javascript" src="../js/check.js"></script>
     <script src="../PopupWin/lhgdialog.min.js" type="text/javascript"></script>
      
    <script>
        $(document).ready(function () {
    try {
        parent.window.MpLoading(0);
    } catch (e) { }
    });
    </script>
</body>
</html>
